import socket
port = 8080
host = 'localhost'

#建立socket对象
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

#进行连接
s.connect((host, port))
while True:
    msg = input('>>: ').strip()
    if not msg:
        continue
    s.send(msg.encode('utf-8'))
    print('has send')

    data = s.recv(1028)
    print('has recv')
    print(data.decode('utf-8'))

s.close()
